cmake_minimum_required(VERSION 3.19)
project(KVStorage)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0")
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
set(protobuf_MODULE_COMPATIBLE TRUE)
set(PROJECT_PATH ${PROJECT_SOURCE_DIR}/kvstorage)

find_package(Threads REQUIRED)
find_package(Boost REQUIRED COMPONENTS serialization)
find_package(gRPC CONFIG REQUIRED)
find_package(Protobuf CONFIG REQUIRED)
find_package(glog REQUIRED)

include_directories(${PROJECT_SOURCE_DIR}/3rdparty)
include_directories(${PROJECT_PATH}/include)
include_directories(${PROJECT_PATH}/proto)
aux_source_directory(${PROJECT_PATH}/src/rpc RPC)
aux_source_directory(${PROJECT_PATH}/src/raft RAFT)
file(GLOB PROTO "${PROJECT_PATH}/proto/*.pb.cc")

add_subdirectory(test)
add_subdirectory(example)